# coding=utf-8

import unittest
import HTMLTestRunner
import time
from unittestreport import TestRunner


def run():
    test_dir = './testcase'
    suite = unittest.defaultTestLoader.discover(start_dir=test_dir, pattern='test*.py')

    # with open(reportname, 'w', encoding='utf-8') as f:
    # runner = HTMLTestRunner.HTMLTestRunner(
    #     stream=f,
    #     title='测试报告',
    #     description='Test the import testcase'
    #
    # )
    runner = TestRunner(suite, title='测试报告',
                        desc='Test the import testcase')
    runner.run(thread_count=3)
    # time.sleep(3)
    # 发送邮件
    # mail = sendmail.SendMail()
    # mail.send()


if __name__ == '__main__':
    run()
